/**
 * Copyright 2009 Erick Armbrust 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0 
 *   
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 */

package tapioca.dt;

import junit.framework.TestCase;

/**
 * Tests for the {@link State} enum.
 *
 * @author armbrust@gmail.com (Erick Armbrust)
 */
public class StateTest extends TestCase {

  public void testToString() {
    assertEquals("0init", State.INIT_0.toString());
    assertEquals("1ready", State.READY_1.toString());
    assertEquals("2locked", State.LOCKED_2.toString());
    assertEquals("3checked", State.CHECKED_3.toString());
    assertEquals("3aborting", State.ABORTING_3.toString());
    assertEquals("4done", State.DONE_4.toString());
    assertEquals("4aborted", State.ABORTED_4.toString());
  }
  
  public void testGetValue() {
    assertEquals(State.INIT_0, State.getValue(State.INIT_0.toString()));
    assertEquals(State.READY_1, State.getValue(State.READY_1.toString()));
    assertEquals(State.LOCKED_2, State.getValue(State.LOCKED_2.toString()));
    assertEquals(State.CHECKED_3, State.getValue(State.CHECKED_3.toString()));
    assertEquals(State.ABORTING_3, State.getValue(State.ABORTING_3.toString()));
    assertEquals(State.DONE_4, State.getValue(State.DONE_4.toString()));
    assertEquals(State.ABORTED_4, State.getValue(State.ABORTED_4.toString()));    
  }
  
}
